package cc.fs.myproject.utils;

import android.content.Context;
import android.content.DialogInterface;
import android.content.res.ColorStateList;
import android.support.v7.app.AlertDialog;
import android.widget.Button;

import cc.fs.myproject.R;

/**
 * Created by fostion on 2015/7/30.
 */
public class AlertDialogShowHelper implements DialogInterface.OnShowListener {


    public Context context;
    private int textColor;

    public AlertDialogShowHelper(Context context) {
        this.context = context;
        this.textColor = context.getResources().getColor(R.color.theme_primary);
    }

    @Override
    public void onShow(DialogInterface dialog) {

        AlertDialog myDialog = (AlertDialog) dialog;
        Button button = null;
        button = myDialog.getButton(myDialog.BUTTON_POSITIVE);
        if (button != null)
            button.setTextColor(textColor);
        button = myDialog.getButton(myDialog.BUTTON_NEGATIVE);
        if (button != null)
            button.setTextColor(textColor);
        button = myDialog.getButton(myDialog.BUTTON_NEUTRAL);
        if (button != null)
            button.setTextColor(textColor);
    }
}
